
package com.jf.cloud.api.auth.feign;

import com.jf.cloud.api.auth.vo.AuthSocialVO;
import com.jf.cloud.common.feign.FeignInsideAuthConfig;
import com.jf.cloud.common.response.ServerResponseEntity;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author zz
 * @date 2020/9/22
 */
@FeignClient(value = "jfcloud-auth",contextId ="auth-social")
public interface AuthSocialFeignClient {

    /**
     * 获取根据尝试社交登录时，保存的临时的uid获取社交
     * @param tempUid tempUid
     * @return 用户社交账号信息
     */
    @GetMapping(value = FeignInsideAuthConfig.FEIGN_URL_PREFIX + "/insider/social")
    ServerResponseEntity<AuthSocialVO> getByTempUid(@RequestParam("tempUid")String tempUid);

    /**
     * 通过小程序信息获取用户手机号
     * @param sessionKey 小程序session_key
     * @param encryptedData 微信小程序的encryptedData
     * @param ivStr 微信小程序的ivStr
     * @return mobile
     */
    @GetMapping(value = FeignInsideAuthConfig.FEIGN_URL_PREFIX + "/insider/social/getMobileByMaInfo")
    ServerResponseEntity<String> getMobileByMaInfo(@RequestParam("accessToken")String sessionKey, @RequestParam("encryptedData")String encryptedData,@RequestParam("ivStr") String ivStr);


    /**
     * 根据第三方账号id和第三方系统类型获取账号
     * @param bizUserId
     * @param socialType
     * @return
     */
    @GetMapping(value = FeignInsideAuthConfig.FEIGN_URL_PREFIX + "/insider/social/getByUserIdAndSocialType")
    ServerResponseEntity<AuthSocialVO> getByUserIdAndSocialType(@RequestParam("bizUserId")String bizUserId, @RequestParam("socialType") Integer socialType);

    /**
     * 根据手机号获取账号
     * @param phone
     * @return
     */
    @GetMapping(value = FeignInsideAuthConfig.FEIGN_URL_PREFIX + "/insider/social/getBizUserIdByPhone")
    ServerResponseEntity<AuthSocialVO> getBizUserIdByPhone(@RequestParam("phone")String phone);

    /**
     * 根据手机号获取账号
     * @param userId
     * @return
     */
    @GetMapping(value = FeignInsideAuthConfig.FEIGN_URL_PREFIX + "/insider/social/getUserInfoByUserId")
    ServerResponseEntity<AuthSocialVO> getUserInfoByUserId(@RequestParam("userId") Long  userId);

}
